package com.kylin.artwork.openapi.starter.config;

import com.kylin.artwork.openapi.starter.interceptor.TraceIdInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 添加拦截器
 * @author Damon S.
 * @version v1.0.1
 * @date 2020年12月25日 16:35
 */
@Configuration
public class WebMvcConfigure implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new TraceIdInterceptor())
                .addPathPatterns("/api_v1/**")
                .excludePathPatterns("/");
    }
}
